<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=latin1">
        <link rel="stylesheet" type="text/css" href="../padrao.css" />
        <link rel="stylesheet" href="../jQuery/lista.css" type="text/css" media="all" />
        <script type="text/javascript" src="../jQuery/jquery-1.2.1.pack.js"></script>
        <script type="text/javascript" src="../jQuery/busca.js"></script>
        <script type="text/javascript" src="../sorttable.js"></script>

        <title> Template </title>

        <?php
        ob_start();
        include '../infobox.php';
        include '../verifica_usuario.php';
        include '../functions.php';
        include '../functions_office.php';
        include '../menu.php';
        ?>

    </head>
    <body>
        <div class="conteudo">
            <p class="titulopesquisa" align='center'> PRECOS ESPECIAIS </p>
            <?php
            $orderby = $_GET[orderby];
            if ($orderby == "") {
                $orderby = "EMPRESAS_cpf_cnpj";
            }
            include("mysqlconfig.inc");
            $query = "select * from PRECOS
                      ORDER BY $orderby ASC; ";


            $res = mysql_query($query);
            $num_reg = mysql_num_rows($res);


            echo "<table> ";

            //titulos das colunas
            echo "<tr class='titulo'>";
            echo "<td> <a href='?orderby=id_precos'> ID </a> </td>";
            echo "<td> <a href='?orderby=ATERROS_nome'> Aterro </a> </td>";
            echo "<td> <a href='?orderby=EMPRESAS_nome'> Empresa </a> </td>";
            echo "<td> <a href='?orderby=EMPRESAS_cpf_cnpj'> CPF/CNPJ </a> </td>";
            echo "<td> <a href='?orderby=valor_poly'> Valor especial Poly </a> </td>";
            echo "<td> <a href='?orderby=valor_truck'> Valor especial Truck </a> </td>";
            echo "<td> <a href='?orderby=valor_toco'> Valor especial Toco </a> </td>";
            echo "<td> <a href='?orderby=valor_carreta'> Valor especial Carreta </a> </td>";
            echo "<td> <a href='?orderby=valor_transbordo'> Valor especial Transbordo </a> </td>";
            echo "</tr>";

            for ($i = 0; $i < $num_reg; $i++) {
                $mostra = mysql_fetch_array($res);
                if ($i % 2 == 1) {
                    $tipolinha = "tipo1";
                } else {
                    $tipolinha = "tipo2";
                }
                echo "<tr class='$tipolinha'>";
                echo "<td> $mostra[id_precos] </td>";
                echo "<td> $mostra[ATERROS_nome] </td>";
                echo "<td> $mostra[EMPRESAS_nome] </td>";
                echo "<td> $mostra[EMPRESAS_cpf_cnpj] </td>";
                echo "<td> $mostra[valor_poly] </td>";
                echo "<td> $mostra[valor_truck] </td>";
                echo "<td> $mostra[valor_toco] </td>";
                echo "<td> $mostra[valor_carreta] </td>";
                echo "<td> $mostra[valor_transbordo] </td>";
                echo "</tr>";
            }
            echo "</form>";
            echo "</table>";
//informa a quantidade de registros encontrados
            echo "$num_reg Precos especiais cadastrados <br>";
//encerra a conexão
            mysql_close($con);
            ?>
        </div>
    </body>
</html><?php
            // put your code here
            ?>
</body>
</html>
